#ifndef WIDGET_H
#define WIDGET_H

#include <QWidget>

#include <QCoreApplication>
#include <QStorageInfo>
#include <QDebug>
#include <windows.h>
#include "DisplayMainwindow.h"
#include "UdiskInspection.h"

QT_BEGIN_NAMESPACE
namespace Ui { class Widget; }
QT_END_NAMESPACE


class Widget : public QWidget
{
    Q_OBJECT

public:
    Widget(QWidget *parent = nullptr);
    ~Widget();

    bool isRemovableDrive(const QString& drivePath);

    void detectUsbChange();
    void updateDisplay();
    bool getLogin();
    void setLogin(bool value);
    void Auto_Mount();

    bool IsUsbDriveInserted(const QString &DrivePath);
    void Auto_DisMount();

public:
    static QStringList MountPathList;

signals:
    void updateFromSecondWindow(bool result); // 用于接收来自 SecondWindow 的信号的槽

private slots:
    void onUpdateFromSecondWindow(bool result); // 处理来自 SecondWindow 的信号的槽函数

    void on_btnMount_clicked();

    void initializeComboBox();  // 初始化函数

    void on_btnMount_2_clicked();

private:
    Ui::Widget *ui;
    CustomWindow *cust;
    QString drivePath1;    
    QStringList drivePathList;

    bool conditionIsMet();
    bool isLogin = false;

    MyDialog *MyD;

protected:
    void closeEvent(QCloseEvent *event) override;
    void showEvent(QShowEvent *event) override;

    bool eventFilter(QObject *object, QEvent *event) override;

signals:
    void widgetClicked();

};
#endif // WIDGET_H
